function result=d(varargin)
% PURPOSE: Roll dice
%---------------------------------------------------
% USAGE: result=d(num,sides)
% where: num = number of dice to be rolled
% where: sides = sides of the die
%---------------------------------------------------
% RETURNS: The result of the random roll
% --------------------------------------------------
% SEE ALSO: 
%---------------------------------------------------
% REFERENCES:
%---------------------------------------------------
% REMARKS:
%---------------------------------------------------

% Written by: 
% John M. Murray
% 1/31/2011
num=varargin{1};
sides=varargin{2};
dice=randi(sides,num,1);
fprintf('%dd%d\n',num,sides);
for i=1:sides
	fprintf(' %d : %d\n',i,length(dice(dice==i)));
end
fprintf('\nResult: %d\n',sum(dice));
result=sum(dice);
end